home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 04 January 1999
- //
- // Remove string items from a string array. A new string array with the
- // items removed is returned. Note that all occurrences of the given
- // string items will be removed from the string array.
- //
- // flags:
- // string[] $items A list of string values to remove from the string array
- // string[] $list A list of string values
- //
- // returns:
- // string[] : Original list with all occurrences of the string items
- // removed. If none of the string items are in the string array then
- // the returned string array is identical to the argument string array.
- //
- // examples:
- // string $list[] = { a, b, c, d, e, f, g };
- // string $items[] = { a, c, e, g };
- // string $diff[] = AWRemoveStringsFromStringArray($items, $list);
- // // Result : { b, d, f } //
- //
- // Note: Use stringArrayRemove instead.
- //
-
- global proc string [] AWRemoveStringsFromStringArray(
- string $items[],
- string $list[])
- {
- string $item, $listItem, $result[];
- int $keep, $resultIndex = 0;
-
- for ($listItem in $list) {
- $keep = 1;
- for ($item in $items) {
- if ($item == $listItem) {
- $keep = 0;
- break;
- }
- }
- if ($keep) $result[$resultIndex++] = $listItem;
- }
-
- return $result;
- }
-
-